/**
 * 
 */
package com.revenco.bi.dao.nutz;

import java.util.List;

import org.nutz.dao.Cnd;
import org.nutz.dao.Condition;
import org.springframework.stereotype.Repository;

import com.revenco.bi.dao.TnColumnInfoDao;
import com.revenco.bi.model.TnColumnInfo;

/**
 * @author LingJun
 * @version $Revision:1.0.0, 2014年1月13日 下午1:16:18 
 */
@Repository
public class TnColumnInfoDaoImpl extends AstractDaoImpl implements TnColumnInfoDao {

	public List<TnColumnInfo> getColumnsByTableId(String tableId) {
		Condition condition = Cnd.where("TABLE_ID", "=", tableId);
		return this.getDao().query(TnColumnInfo.class, condition);
	}
	
	public TnColumnInfo getTNColumnInfoByName(String tableId, String name) {
		Condition condition = Cnd.where("TABLE_ID", "=", tableId);
		condition = Cnd.where("NAME", "=", name);
		TnColumnInfo tclInfo = this.getDao().fetch(TnColumnInfo.class, condition);
		return tclInfo;
	}

	public TnColumnInfo getNameById(String columnId) {
		Condition condition = Cnd.where("COLUMN_ID", "=", columnId);
		return this.getDao().query(TnColumnInfo.class, condition).get(0);
	}
}
